package site.lanmushan.framework.mapper.params;

import net.sf.jsqlparser.expression.ExpressionVisitor;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Administrator
 */
public class SlashAndExpression extends SlashExpression  {

    @Override
    public String getStringExpression() {
        return "and";
    }

    @Override
    public void accept(ExpressionVisitor expressionVisitor) {

    }

    @Override
    public String toString() {
        List<String> result = expressions.stream().map(it -> it.toString()).collect(Collectors.toList());
        if (result.isEmpty()) {
            return "";
        }
        return "(" + String.join(" and ", result) + ")";
    }

}
